<template>
    <div class="share-box">
        <a style="text-decoration:none;" target="_blank" :href='subURL'>
            <v-icon color="blue">mdi-mail</v-icon>
            <span>关注</span></a>
        <div ga_event="click_share_weixin" class="share-type share-weixin" @click="dialog = true">
            <v-icon color="green">mdi-wechat</v-icon>
            <span>微信</span>
        </div>
        <v-dialog v-model="dialog" width="250px" hide-overlay>
            <v-card>
                <h3 align="center">请打开微信扫一扫:</h3>
                <p/>
                <qr-code :url="url" align="center"/>
                <p/>
                <v-btn align="center" @click="dialog=false" style="left: 50%; transform:translateX(-50%)">关闭
                </v-btn>
            </v-card>
        </v-dialog>
    </div>
</template>

<script>
    import config from '../../gridsome.config';
    import QrCode from "./QrCode";

    export default {
        name: "ShareBox",
        components: {QrCode},
        props: {
            url: {type: String, default: ''},
            model: {type: String, default: ''},
            id: {type: Number, default: 0},
        },
        data() {
            return {
                odooUrl: config.odooUrl, dialog: false,
            }
        },
        computed: {
            subURL() {
                return config.odooUrl + "/mail/follow?model=" + this.model + "&res_id=" + this.id
            }

        }

    }
</script>

<style scoped>
    .share-box {
        position: fixed;
        /*_position: absolute;*/
        /*left: 0%;*/
        margin-left: -70px;
        width: 63px;
        top: 150px;
    }
</style>